package com.hxh.entity.po;

import lombok.Data;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * @ProjectName: AICode
 * @Package: com.example.entity.po
 * @ClassName: TableInfo
 * @Author: HXH
 * @Description: 数据表信息
 * @Date: 2023/12/11 9:56
 */
@Data
public class TableInfo implements ExplainByResultSet<TableInfo>{
    /**
     * 表名
     **/
    private String tableName;

    /**
     * 已存数量
     **/
    private Long tableRows;

    /**
     * 创建时间
     **/
    private String createTime;

    /**
     * 更新时间
     **/
    private String updateTime;

    /**
     * 编码
     **/
    private String tableCollation;

    /**
     * 表说明
     **/
    private String tableComment;

    private List<FieldName> fieldNames;

    @Override
    public TableInfo getOneByRs(ResultSet resultSet) throws SQLException {
        TableInfo tableInfo = this;
        tableInfo.setTableName(resultSet.getString("TABLE_NAME"));
        tableInfo.setTableRows(resultSet.getLong("TABLE_ROWS"));
        tableInfo.setCreateTime(resultSet.getString("CREATE_TIME"));
        tableInfo.setUpdateTime(resultSet.getString("UPDATE_TIME"));
        tableInfo.setTableCollation(resultSet.getString("TABLE_COLLATION"));
        tableInfo.setTableComment(resultSet.getString("TABLE_COMMENT"));
        return tableInfo;
    }
}

